home *** CD-ROM | disk | FTP | other *** search
- ;Sound Effect Demo
- ;-----------------
- ;An example of modulating a sound sample.
- ;
- ;LMB plays the sound.
- ;RMB exits the demo.
-
- opt o+
-
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "Sound",CODE
-
- ;==========================================================================;
- ; INITIALISE DEMO
- ;==========================================================================;
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq Quit
-
- move.l GMS_Base(pc),a6
- CALL SetUserPri
-
- CALL AllocAudio
- tst.w d0
- bne.s AudioError
-
- lea Sound_Gong(pc),a0
- CALL InitSound
- tst.w d0
- bne.s AudioError
-
- ;==========================================================================;
- ; MAIN LOOP
- ;==========================================================================;
-
- MainLoop:
- move.l GMS_Base(pc),a6
- CALL Wait_OSVBL
-
- moveq #JPORT1,d0
- CALL Read_Mouse
- btst #MB_RMB,d0
- bne.s ReturnDOS
- btst #MB_LMB,d0
- beq.s MainLoop
-
- lea Sound_Gong(pc),a0
- CALL PlaySoundPri
- lea Sound_Modulus(pc),a0
- CALL PlaySoundPri
-
- .release
- moveq #JPORT1,d0
- CALL Read_Mouse
- btst #MB_LMB,d0
- bne.s .release
-
- bra.s MainLoop
-
- ;===========================================================================;
- ; RETURN TO DOS
- ;===========================================================================;
-
- ReturnDOS:
- move.l GMS_Base(pc),a6
- CALL FreeAudio
- lea Sound_Gong(pc),a0
- CALL FreeSound
- AudioError:
- move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- Quit MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- AMT_PLANES = 1
-
- ScreenStruct:
- dc.l "GSV1",0
- dc.l 0,0,0 ;Screen_Mem1/2/3
- dc.l 0 ;Screen link.
- dc.l ScreenPalette ;Address of screen palette.
- dc.l 0 ;Address of rasterlist.
- dc.l 4 ;Amt of colours in palette.
- dc.w 320,256,320,256 ;Screen & Pic Height/Width.
- dc.w AMT_PLANES ;Amt_Planes
- dc.w 0,0 ;Top Of Screen, X/Y
- dc.w 0,0 ;X/Y counters (for scrolling).
- dc.l 0 ;Special attributes.
- dc.w LORES ;Screen mode.
- dc.b INTERLEAVED ;Screen type
- dc.b 0 ;Reserved
- even
-
- ScreenPalette:
- dc.w $0000,$0DDD,$0666,$0222
-
- Sound_Modulus:
- dc.l "SMV1",0 ;Structure version.
- dc.w CHANNEL1 ;Channel to play through.
- dc.w 1 ;Priority
- dc.l 0 ;Header
- dc.l Modulus ;Address
- dc.l 8 ;Length
- dc.w OCT_A7S ;Period
- dc.w 100 ;Volume
- dc.l SBIT8|SREPEAT|SMODPER ;Attributes
- dc.l 0 ;File
-
- Sound_Gong:
- dc.l "SMV1",0 ;Structure version.
- dc.w CHANNEL2 ;Channel to play through.
- dc.w 1 ;Priority
- dc.l Gong ;Header
- dc.l 0 ;Address
- dc.l 0 ;Length
- dc.w OCT_C2S ;Period
- dc.w 100 ;Volume
- dc.l SBIT8 ;Attributes
- dc.l Gong ;File
-
- Gong: dc.b "GAMESLIB:data/IFF.Lightning",0
- even
-
- ;===========================================================================;
- ; SOUND DATA (CHIP)
- ;===========================================================================;
-
- SECTION "SoundArea",DATA_C
-
- Modulus: dc.w 600,550,500,450,400,450,500,550
-
-